#include "ReflexPort.h"
#include "ByteBufferPool.h"
#include "NatSession.h"

using namespace cm_nat;

using namespace Poco;
using namespace Poco::Net;

int main()
{
    SocketReactor reactor;
    reactor.setTimeout(Poco::Timespan(1,0,0,0,0));

    ByteBufferPool bpool;
    bpool.init(10, 200);

    //SocketAddress stunSa("192.168.1.99","3478");
    SocketAddress stunSa("stun.l.google.com","19302");

    NatSession ns(&bpool);
    ns.setStunServer(stunSa);

    ReflexPort rp(reactor, &bpool);
    rp.setHandler(&ns);

    ns.setPort(&rp);

    SocketAddress localSa("192.168.1.99", 0);
    rp.init( localSa );

    ns.bind();
    //then wait bind ready event

    reactor.run();


    return 0;
}